package edu.hawaii.duedates.wicket;

import org.apache.wicket.Page;
import org.apache.wicket.Request;
import org.apache.wicket.Response;
import org.apache.wicket.Session;
import org.apache.wicket.protocol.http.WebApplication;

/**
 * Application object for deployable version of this web application.
 * 
 * @author robin
 *
 */
public class DueDatesWebApp extends WebApplication {

  /**
   * Indicate that Index is the home page for this application.
   * 
   * @return The home page, which is Index.
   */
  @Override
  public Class<? extends Page> getHomePage() {    
    return Index.class;
  }
  
  /**
   * Return a session object to hold the models for each user of this application.
   * 
   * @param request The requested object.
   * @param response The response object.
   * @return The user session.
   */
  public Session newSession(Request request, Response response) {
    return new DueDatesSession(this, request);
  }
  
  /**
   * Return this web application to provide a session for the current user.
   * 
   * @return The web application.
   */
  public static DueDatesWebApp get() {
    return (DueDatesWebApp) WebApplication.get();
  }

}
